// 顺序执行异步任务，所有完成就返回
function anonymous(source, target, routesList) {
    "use strict";
    return new Promise((_resolve, _reject) => {
        var _sync = true;
        var _context;
        var _x = this._x;
        var _fn0 = _x[0];
        var _hasResult0 = false;
        _fn0(source, target, routesList).then(_result0 => {
            _hasResult0 = true;
            var _fn1 = _x[1];
            var _hasResult1 = false;
            _fn1(source, target, routesList).then(_result1 => {
                _hasResult1 = true;
                _resolve();
            }, _err1 => {
                if (_hasResult1) throw _err1;
                if (_sync)
                    _resolve(Promise.resolve().then(() => {
                        throw _err1;
                    }));
                else
                    _reject(_err1);
            });
        }, _err0 => {
            if (_hasResult0) throw _err0;
            if (_sync)
                _resolve(Promise.resolve().then(() => {
                    throw _err0;
                }));
            else
                _reject(_err0);
        });
        _sync = false;
    });
}